<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="common/header.jsp"%>
 <div class="row">
  
  <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>app超市 </h2>
                    <div class="clearfix"></div>
                    <c:if test="admin = ${username }"><a href="${pageContext.request.contextPath }/DevAppCommodityPurchase/addHomepage" class="btn btn-info" type="button">添加商品</a></c:if>
                    	<%-- <a href="${pageContext.request.contextPath }/DevAppCommodityPurchase/addHomepage" class="btn btn-info" type="button">添加商品</a> --%>
                        <a href="${pageContext.request.contextPath }/DevAppCommodityPurchase/shoppingCart2" class="btn btn-info" >我的购物车</a>
                  </div>
                 
                  <div class="x_content">
                
                    <table id="datatable" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>名称</th>
                          <th>单价</th>
                          <th>图片</th>
                          <th style="width:125px">操作</th>
                        </tr>
                      </thead>
                      <tbody>
                      <c:forEach items="${listCommodity }" var="listCommodity">
                        <tr>
                          <td >${listCommodity.name }
                             <input name ="id" type="hidden" value="${listCommodity.id }"/>
                          </td>
                          
                          <td >${listCommodity.money }</td>
                          
                          <td><img height="50px" width="50px" src="${listCommodity.pic }"></td>
                          
                          <td>
							<div class="btn-group">
                     		  <button type="button" class="btn btn-danger">点击操作</button>
		                      <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
		                        <span class="caret"></span>
		                        <span class="sr-only">Toggle Dropdown</span>
		                      </button>
		                      <ul class="dropdown-menu" role="menu">
		                        <li>
		                        <a  href="${pageContext.request.contextPath }/DevAppCommodityPurchase/shoppingCart?id=${listCommodity.id}" class="btn btn-danger">加入购物车</a>
		                        
		                        </li>
		                        <li>
		                         <c:if test="admin = ${listCommodity.username }">  <a href="#" class="btn btn-danger">删除</a></c:if>
		                        <a href="#" class="btn btn-danger">删除</a>
		                        </li>
		                      </ul>
		                    </div>
						  </td>
                        </tr>
                      </c:forEach>
                      </tbody>
                    </table>
                  </div>
                 
                </div>
              </div>
              <div class="row">
					<div class="col-sm-5">
						<div class="dataTables_info" id="datatable-responsive_info"
							role="status" aria-live="polite">共${pageBean.totalCount }条记录
							${pageBean.currentPage }/${pageBean.totalPage } 页</div>
					</div>
					<div class="col-sm-7">
						<div class="dataTables_paginate paging_simple_numbers"
							id="datatable-responsive_paginate">
							<ul class="pagination">
								<c:if test="${pageBean.currentPage > 1 }">
									<li class="paginate_button previous"><a
										href="javascript:page(1);"
										aria-controls="datatable-responsive" data-dt-idx="0"
										tabindex="0">首页</a>
									</li>
									<li class="paginate_button "><a
										href="javascript:page(${pageBean.currentPage } - 1);"
										aria-controls="datatable-responsive" data-dt-idx="1"
										tabindex="0">上一页</a>
									</li>
								</c:if>	
								<c:if test="${pageBean.currentPage < pageBean.totalPage }">
									<li class="paginate_button "><a
										href="javascript:page(${pageBean.currentPage } + 1);"
										aria-controls="datatable-responsive" data-dt-idx="1"
										tabindex="0">下一页</a>
									</li>
									<li class="paginate_button next"><a
										href="javascript:page(${pageBean.totalPage });"
										aria-controls="datatable-responsive" data-dt-idx="7"
										tabindex="0">最后一页</a>
									</li>
								</c:if>	
							</ul>
						</div>
					</div>
				</div>
</div>
<%@include file="common/footer.jsp"%>